from pydantic import BaseModel, Field
from typing import Optional
from fastapi import Query


class RoleQuery(BaseModel):
    page: int = Field(1, ge=1, description="页码", alias="current")
    size: int = Field(10, ge=1, le=100, description="每页数量")
    name: Optional[str] = Field(None, description="角色名称筛选")
    status: Optional[bool] = Field(None, description="状态筛选：True启用，False禁用")
    keyword: Optional[str] = Field(None, description="关键词搜索（名称/描述）")


def role_list_query(
    page: int = Query(1, ge=1, description="页码"),
    size: int = Query(10, ge=1, le=100, description="每页数量"),
    name: Optional[str] = Query(None, description="角色名称筛选"),
    status: Optional[bool] = Query(None, description="状态筛选：True启用，False禁用"),
    keyword: Optional[str] = Query(None, description="关键词搜索（名称/描述）"),
) -> RoleQuery:
    return RoleQuery(
        page=page,
        size=size,
        name=name,
        status=status,
        keyword=keyword,
    )